package cn.kgc.springboot.controller;

import cn.kgc.springboot.entity.User;
import cn.kgc.springboot.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: 课工场
 * @Version: v1.0  2023/7/25
 * @Description:
 */
@RestController
@RequestMapping("user")
public class UserController {

    @Autowired
    private UserService userService;
    @RequestMapping("list")
    public List<User> getList(){
        List<User> list = userService.list();
        return  list;
    }


    @RequestMapping("delete")
    public Boolean deleteById(Integer id){
        boolean b = userService.removeById(id);
        return  b;
    }

    @RequestMapping("sex")
    public List<User> getBySex(String sex){
        List<User> all = userService.getAll(sex);
        return  all;
    }
}
